
import ${packageName}.model.${modelName};
import com.xzops.bnm.common.model.response.Message;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
* @author：yzw
* @Date：${.now?string["yyyy/MM/dd"]}
* @desc：
*/
@Controller
@RequestMapping("backstage/${modelName?uncap_first}")
public class ${modelName}Controller {

	@Resource
	private ${modelName}Service ${modelName?uncap_first}Service;

	@RequestMapping("to${modelName}Page")
	public String to${modelName}Page(HttpServletRequest request) {
		String username = SecurityContextHolder.getContext().getAuthentication().getName();
		request.setAttribute("userName", username);
		return "${modelName?uncap_first}/${modelName?uncap_first}";
	}

	@RequestMapping(value = "load/${modelName?uncap_first}/fordt")
	@ResponseBody
	public DataTablesResp<${modelName}> load${modelName}ForDT(@RequestBody DataTablesReqt reqtParams) {
		return ${modelName?uncap_first}Service.getDataList(reqtParams);
	}

	/**
	 * 批量删除
	 *
	 * @param ids
	 * @return
	 */
	@ResponseBody
	@RequestMapping("delete${modelName}")
	public Message delete${modelName}(@RequestParam("ids[]") List<String> ids) {
		return ${modelName?uncap_first}Service.deleteBatch(ids);
	}

	@RequestMapping(value = "save${modelName}", method = RequestMethod.POST)
	@ResponseBody
	public Message save${modelName}(${modelName} ${modelName?uncap_first}) {
		return ${modelName?uncap_first}Service.save(${modelName?uncap_first});
	}
}